

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>The web module &mdash; pyamp v1.2 documentation</title>
    <link rel="stylesheet" href="_static/default.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '',
        VERSION:     '1.2',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="top" title="pyamp v1.2 documentation" href="index.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li><a href="index.html">pyamp v1.2 documentation</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="module-pyamp.web">
<span id="the-web-module"></span><h1>The web module<a class="headerlink" href="#module-pyamp.web" title="Permalink to this headline">¶</a></h1>
<p>The web module contains classes and methods to perform tasks
pertaining to the world wide web, such as accessing the content of
a web page.</p>
<div class="section" id="module-pyamp.web.hacking">
<span id="the-hacking-module"></span><h2>The hacking module<a class="headerlink" href="#module-pyamp.web.hacking" title="Permalink to this headline">¶</a></h2>
<p>Contains the Hacking class which provides functions pertaining
to hacking web sites.</p>
<dl class="class">
<dt id="pyamp.web.hacking.Hacking">
<em class="property">class </em><tt class="descclassname">pyamp.web.hacking.</tt><tt class="descname">Hacking</tt><a class="reference internal" href="_modules/pyamp/web/hacking.html#Hacking"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.web.hacking.Hacking" title="Permalink to this definition">¶</a></dt>
<dd><p>Contains methods pertaining to Hacking.</p>
<dl class="classmethod">
<dt id="pyamp.web.hacking.Hacking.findAdminPage">
<em class="property">classmethod </em><tt class="descname">findAdminPage</tt><big>(</big><em>baseUrl</em>, <em>adminFile=None</em><big>)</big><a class="reference internal" href="_modules/pyamp/web/hacking.html#Hacking.findAdminPage"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.web.hacking.Hacking.findAdminPage" title="Permalink to this definition">¶</a></dt>
<dd><p>Attempt to find an admin page for a website using
the configured list of possible admin names.</p>
<ul class="simple">
<li>baseUrl - The base URL to look for an admin page</li>
<li>adminFile - The list of possible admin names</li>
</ul>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="id1">
<h2>The web module<a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h2>
<span class="target" id="module-pyamp.web.web"></span><p>The web module provides classes, and functions which provide
various functionality respective to websites.</p>
<dl class="class">
<dt id="pyamp.web.web.UrlRequest">
<em class="property">class </em><tt class="descclassname">pyamp.web.web.</tt><tt class="descname">UrlRequest</tt><a class="reference internal" href="_modules/pyamp/web/web.html#UrlRequest"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.web.web.UrlRequest" title="Permalink to this definition">¶</a></dt>
<dd><p>The UrlRequest provides methods for requesting webpages.</p>
<dl class="classmethod">
<dt id="pyamp.web.web.UrlRequest.authenticate">
<em class="property">classmethod </em><tt class="descname">authenticate</tt><big>(</big><em>username</em>, <em>password</em>, <em>url</em><big>)</big><a class="reference internal" href="_modules/pyamp/web/web.html#UrlRequest.authenticate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.web.web.UrlRequest.authenticate" title="Permalink to this definition">¶</a></dt>
<dd><p>Request a page that requires authentication.</p>
</dd></dl>

<dl class="classmethod">
<dt id="pyamp.web.web.UrlRequest.get">
<em class="property">classmethod </em><tt class="descname">get</tt><big>(</big><em>url</em><big>)</big><a class="reference internal" href="_modules/pyamp/web/web.html#UrlRequest.get"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.web.web.UrlRequest.get" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the content of a page.</p>
</dd></dl>

<dl class="classmethod">
<dt id="pyamp.web.web.UrlRequest.request">
<em class="property">classmethod </em><tt class="descname">request</tt><big>(</big><em>url</em><big>)</big><a class="reference internal" href="_modules/pyamp/web/web.html#UrlRequest.request"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.web.web.UrlRequest.request" title="Permalink to this definition">¶</a></dt>
<dd><p>Request a page.</p>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-pyamp.web.http">
<span id="the-http-module"></span><h2>The http module<a class="headerlink" href="#module-pyamp.web.http" title="Permalink to this headline">¶</a></h2>
<p>The http module contains modules pertaining to creating an HTTP server
to serve pages upon request.</p>
</div>
<div class="section" id="module-pyamp.web.http.constants">
<span id="the-constants-module"></span><h2>The constants module<a class="headerlink" href="#module-pyamp.web.http.constants" title="Permalink to this headline">¶</a></h2>
<p>The constants module contains classes which define constants relating
to HTTP data.</p>
<dl class="class">
<dt id="pyamp.web.http.constants.ContentTypes">
<em class="property">class </em><tt class="descclassname">pyamp.web.http.constants.</tt><tt class="descname">ContentTypes</tt><a class="reference internal" href="_modules/pyamp/web/http/constants.html#ContentTypes"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.web.http.constants.ContentTypes" title="Permalink to this definition">¶</a></dt>
<dd><p>The ContentTypes class contains constants pertaining to
different types of content.</p>
<dl class="attribute">
<dt id="pyamp.web.http.constants.ContentTypes.Bmp">
<tt class="descname">Bmp</tt><a class="headerlink" href="#pyamp.web.http.constants.ContentTypes.Bmp" title="Permalink to this definition">¶</a></dt>
<dd><p>A BMP image content.</p>
</dd></dl>

<dl class="attribute">
<dt id="pyamp.web.http.constants.ContentTypes.Css">
<tt class="descname">Css</tt><a class="headerlink" href="#pyamp.web.http.constants.ContentTypes.Css" title="Permalink to this definition">¶</a></dt>
<dd><p>CSS content.</p>
</dd></dl>

<dl class="attribute">
<dt id="pyamp.web.http.constants.ContentTypes.Gif">
<tt class="descname">Gif</tt><a class="headerlink" href="#pyamp.web.http.constants.ContentTypes.Gif" title="Permalink to this definition">¶</a></dt>
<dd><p>A GIF image content.</p>
</dd></dl>

<dl class="attribute">
<dt id="pyamp.web.http.constants.ContentTypes.Ico">
<tt class="descname">Ico</tt><a class="headerlink" href="#pyamp.web.http.constants.ContentTypes.Ico" title="Permalink to this definition">¶</a></dt>
<dd><p>An ICO image content.</p>
</dd></dl>

<dl class="attribute">
<dt id="pyamp.web.http.constants.ContentTypes.JavaScript">
<tt class="descname">JavaScript</tt><a class="headerlink" href="#pyamp.web.http.constants.ContentTypes.JavaScript" title="Permalink to this definition">¶</a></dt>
<dd><p>JavaScript content.</p>
</dd></dl>

<dl class="attribute">
<dt id="pyamp.web.http.constants.ContentTypes.Json">
<tt class="descname">Json</tt><a class="headerlink" href="#pyamp.web.http.constants.ContentTypes.Json" title="Permalink to this definition">¶</a></dt>
<dd><p>JSON content.</p>
</dd></dl>

<dl class="attribute">
<dt id="pyamp.web.http.constants.ContentTypes.Png">
<tt class="descname">Png</tt><a class="headerlink" href="#pyamp.web.http.constants.ContentTypes.Png" title="Permalink to this definition">¶</a></dt>
<dd><p>An PNG image content.</p>
</dd></dl>

<dl class="attribute">
<dt id="pyamp.web.http.constants.ContentTypes.TextHtml">
<tt class="descname">TextHtml</tt><a class="headerlink" href="#pyamp.web.http.constants.ContentTypes.TextHtml" title="Permalink to this definition">¶</a></dt>
<dd><p>Standard text HTML content.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="pyamp.web.http.constants.HeaderIds">
<em class="property">class </em><tt class="descclassname">pyamp.web.http.constants.</tt><tt class="descname">HeaderIds</tt><a class="reference internal" href="_modules/pyamp/web/http/constants.html#HeaderIds"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.web.http.constants.HeaderIds" title="Permalink to this definition">¶</a></dt>
<dd><p>The HeaderIds class contains constants pertaining to header
identifiers.</p>
<dl class="attribute">
<dt id="pyamp.web.http.constants.HeaderIds.ContentType">
<tt class="descname">ContentType</tt><a class="headerlink" href="#pyamp.web.http.constants.HeaderIds.ContentType" title="Permalink to this definition">¶</a></dt>
<dd><p>The content type header id.</p>
</dd></dl>

<dl class="attribute">
<dt id="pyamp.web.http.constants.HeaderIds.Location">
<tt class="descname">Location</tt><a class="headerlink" href="#pyamp.web.http.constants.HeaderIds.Location" title="Permalink to this definition">¶</a></dt>
<dd><p>The location header id.</p>
</dd></dl>

<dl class="attribute">
<dt id="pyamp.web.http.constants.HeaderIds.UserAgent">
<tt class="descname">UserAgent</tt><a class="headerlink" href="#pyamp.web.http.constants.HeaderIds.UserAgent" title="Permalink to this definition">¶</a></dt>
<dd><p>The user agent header id.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="pyamp.web.http.constants.Keys">
<em class="property">class </em><tt class="descclassname">pyamp.web.http.constants.</tt><tt class="descname">Keys</tt><a class="headerlink" href="#pyamp.web.http.constants.Keys" title="Permalink to this definition">¶</a></dt>
<dd><p>The Keys class defines constants that are used as keys to
access certain dictionary values.</p>
<dl class="attribute">
<dt id="pyamp.web.http.constants.Keys.ErrorMessage">
<tt class="descname">ErrorMessage</tt><a class="headerlink" href="#pyamp.web.http.constants.Keys.ErrorMessage" title="Permalink to this definition">¶</a></dt>
<dd><p>The key for the entry containing the error message.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="pyamp.web.http.constants.OperatingSystems">
<em class="property">class </em><tt class="descclassname">pyamp.web.http.constants.</tt><tt class="descname">OperatingSystems</tt><a class="reference internal" href="_modules/pyamp/web/http/constants.html#OperatingSystems"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.web.http.constants.OperatingSystems" title="Permalink to this definition">¶</a></dt>
<dd><p>The OperatingSystems class contains constants pertaining to
the strings used to identify various operating systems.</p>
<dl class="attribute">
<dt id="pyamp.web.http.constants.OperatingSystems.BeOS">
<tt class="descname">BeOS</tt><a class="headerlink" href="#pyamp.web.http.constants.OperatingSystems.BeOS" title="Permalink to this definition">¶</a></dt>
<dd><p>The BeOS OS.</p>
</dd></dl>

<dl class="attribute">
<dt id="pyamp.web.http.constants.OperatingSystems.Linux">
<tt class="descname">Linux</tt><a class="headerlink" href="#pyamp.web.http.constants.OperatingSystems.Linux" title="Permalink to this definition">¶</a></dt>
<dd><p>The Linux OS.</p>
</dd></dl>

<dl class="attribute">
<dt id="pyamp.web.http.constants.OperatingSystems.MacOS">
<tt class="descname">MacOS</tt><a class="headerlink" href="#pyamp.web.http.constants.OperatingSystems.MacOS" title="Permalink to this definition">¶</a></dt>
<dd><p>The Mac OS.</p>
</dd></dl>

<dl class="attribute">
<dt id="pyamp.web.http.constants.OperatingSystems.OS2">
<tt class="descname">OS2</tt><a class="headerlink" href="#pyamp.web.http.constants.OperatingSystems.OS2" title="Permalink to this definition">¶</a></dt>
<dd><p>The OS/2 OS.</p>
</dd></dl>

<dl class="attribute">
<dt id="pyamp.web.http.constants.OperatingSystems.OpenBSD">
<tt class="descname">OpenBSD</tt><a class="headerlink" href="#pyamp.web.http.constants.OperatingSystems.OpenBSD" title="Permalink to this definition">¶</a></dt>
<dd><p>The OpenBSD OS.</p>
</dd></dl>

<dl class="attribute">
<dt id="pyamp.web.http.constants.OperatingSystems.QNX">
<tt class="descname">QNX</tt><a class="headerlink" href="#pyamp.web.http.constants.OperatingSystems.QNX" title="Permalink to this definition">¶</a></dt>
<dd><p>The QNX OS.</p>
</dd></dl>

<dl class="attribute">
<dt id="pyamp.web.http.constants.OperatingSystems.SearchBot">
<tt class="descname">SearchBot</tt><a class="headerlink" href="#pyamp.web.http.constants.OperatingSystems.SearchBot" title="Permalink to this definition">¶</a></dt>
<dd><p>The SearchBot OS.</p>
</dd></dl>

<dl class="attribute">
<dt id="pyamp.web.http.constants.OperatingSystems.SunOS">
<tt class="descname">SunOS</tt><a class="headerlink" href="#pyamp.web.http.constants.OperatingSystems.SunOS" title="Permalink to this definition">¶</a></dt>
<dd><p>The Sun OS OS.</p>
</dd></dl>

<dl class="attribute">
<dt id="pyamp.web.http.constants.OperatingSystems.Windows2000">
<tt class="descname">Windows2000</tt><a class="headerlink" href="#pyamp.web.http.constants.OperatingSystems.Windows2000" title="Permalink to this definition">¶</a></dt>
<dd><p>The Windows 2000 OS.</p>
</dd></dl>

<dl class="attribute">
<dt id="pyamp.web.http.constants.OperatingSystems.Windows3_11">
<tt class="descname">Windows3_11</tt><a class="headerlink" href="#pyamp.web.http.constants.OperatingSystems.Windows3_11" title="Permalink to this definition">¶</a></dt>
<dd><p>The Windows 3.11 OS.</p>
</dd></dl>

<dl class="attribute">
<dt id="pyamp.web.http.constants.OperatingSystems.Windows7">
<tt class="descname">Windows7</tt><a class="headerlink" href="#pyamp.web.http.constants.OperatingSystems.Windows7" title="Permalink to this definition">¶</a></dt>
<dd><p>The Windows 7 OS.</p>
</dd></dl>

<dl class="attribute">
<dt id="pyamp.web.http.constants.OperatingSystems.Windows95">
<tt class="descname">Windows95</tt><a class="headerlink" href="#pyamp.web.http.constants.OperatingSystems.Windows95" title="Permalink to this definition">¶</a></dt>
<dd><p>The Windows 95 OS.</p>
</dd></dl>

<dl class="attribute">
<dt id="pyamp.web.http.constants.OperatingSystems.Windows98">
<tt class="descname">Windows98</tt><a class="headerlink" href="#pyamp.web.http.constants.OperatingSystems.Windows98" title="Permalink to this definition">¶</a></dt>
<dd><p>The Windows 98 OS.</p>
</dd></dl>

<dl class="attribute">
<dt id="pyamp.web.http.constants.OperatingSystems.WindowsME">
<tt class="descname">WindowsME</tt><a class="headerlink" href="#pyamp.web.http.constants.OperatingSystems.WindowsME" title="Permalink to this definition">¶</a></dt>
<dd><p>The Windows ME OS.</p>
</dd></dl>

<dl class="attribute">
<dt id="pyamp.web.http.constants.OperatingSystems.WindowsNT4">
<tt class="descname">WindowsNT4</tt><a class="headerlink" href="#pyamp.web.http.constants.OperatingSystems.WindowsNT4" title="Permalink to this definition">¶</a></dt>
<dd><p>The Windows NT 4.0 OS.</p>
</dd></dl>

<dl class="attribute">
<dt id="pyamp.web.http.constants.OperatingSystems.WindowsServer2003">
<tt class="descname">WindowsServer2003</tt><a class="headerlink" href="#pyamp.web.http.constants.OperatingSystems.WindowsServer2003" title="Permalink to this definition">¶</a></dt>
<dd><p>The Windows Server 2003 OS.</p>
</dd></dl>

<dl class="attribute">
<dt id="pyamp.web.http.constants.OperatingSystems.WindowsVista">
<tt class="descname">WindowsVista</tt><a class="headerlink" href="#pyamp.web.http.constants.OperatingSystems.WindowsVista" title="Permalink to this definition">¶</a></dt>
<dd><p>The Windows Vista OS.</p>
</dd></dl>

<dl class="attribute">
<dt id="pyamp.web.http.constants.OperatingSystems.WindowsXP">
<tt class="descname">WindowsXP</tt><a class="headerlink" href="#pyamp.web.http.constants.OperatingSystems.WindowsXP" title="Permalink to this definition">¶</a></dt>
<dd><p>The Windows XP OS.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="pyamp.web.http.constants.StatusCodes">
<em class="property">class </em><tt class="descclassname">pyamp.web.http.constants.</tt><tt class="descname">StatusCodes</tt><a class="reference internal" href="_modules/pyamp/web/http/constants.html#StatusCodes"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.web.http.constants.StatusCodes" title="Permalink to this definition">¶</a></dt>
<dd><p>The StatusCodes class contains constants pertaining to
HTTP status codes.</p>
<dl class="attribute">
<dt id="pyamp.web.http.constants.StatusCodes.FileNotFound">
<tt class="descname">FileNotFound</tt><a class="headerlink" href="#pyamp.web.http.constants.StatusCodes.FileNotFound" title="Permalink to this definition">¶</a></dt>
<dd><p>The file not found status code.</p>
</dd></dl>

<dl class="attribute">
<dt id="pyamp.web.http.constants.StatusCodes.Found">
<tt class="descname">Found</tt><a class="headerlink" href="#pyamp.web.http.constants.StatusCodes.Found" title="Permalink to this definition">¶</a></dt>
<dd><p>The found status code.</p>
</dd></dl>

<dl class="attribute">
<dt id="pyamp.web.http.constants.StatusCodes.InternalServerError">
<tt class="descname">InternalServerError</tt><a class="headerlink" href="#pyamp.web.http.constants.StatusCodes.InternalServerError" title="Permalink to this definition">¶</a></dt>
<dd><p>The internal server error status code.</p>
</dd></dl>

<dl class="attribute">
<dt id="pyamp.web.http.constants.StatusCodes.MovedPermanently">
<tt class="descname">MovedPermanently</tt><a class="headerlink" href="#pyamp.web.http.constants.StatusCodes.MovedPermanently" title="Permalink to this definition">¶</a></dt>
<dd><p>The moved permanently status code.</p>
</dd></dl>

<dl class="attribute">
<dt id="pyamp.web.http.constants.StatusCodes.OK">
<tt class="descname">OK</tt><a class="headerlink" href="#pyamp.web.http.constants.StatusCodes.OK" title="Permalink to this definition">¶</a></dt>
<dd><p>The OK status code.</p>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-pyamp.web.http.headers">
<span id="the-headers-module"></span><h2>The headers module<a class="headerlink" href="#module-pyamp.web.http.headers" title="Permalink to this headline">¶</a></h2>
<p>The headers module contains a class which provides the ability
to create a specific HTTP header.</p>
<dl class="class">
<dt id="pyamp.web.http.headers.Header">
<em class="property">class </em><tt class="descclassname">pyamp.web.http.headers.</tt><tt class="descname">Header</tt><big>(</big><em>identifier</em>, <em>value</em><big>)</big><a class="reference internal" href="_modules/pyamp/web/http/headers.html#Header"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.web.http.headers.Header" title="Permalink to this definition">¶</a></dt>
<dd><p>The Header class provides the ability to create a specific
HTTP header.</p>
<ul class="simple">
<li>identifier &#8211; The header identifier</li>
<li>value &#8211; The value for the header</li>
</ul>
<dl class="classmethod">
<dt id="pyamp.web.http.headers.Header.contentType">
<em class="property">classmethod </em><tt class="descname">contentType</tt><big>(</big><em>contentType</em><big>)</big><a class="reference internal" href="_modules/pyamp/web/http/headers.html#Header.contentType"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.web.http.headers.Header.contentType" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a content type header.</p>
<ul class="simple">
<li>contentType &#8211; The type of content</li>
</ul>
</dd></dl>

<dl class="method">
<dt id="pyamp.web.http.headers.Header.getId">
<tt class="descname">getId</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/pyamp/web/http/headers.html#Header.getId"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.web.http.headers.Header.getId" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the ID for this header.</p>
</dd></dl>

<dl class="classmethod">
<dt id="pyamp.web.http.headers.Header.getOperatingSystem">
<em class="property">classmethod </em><tt class="descname">getOperatingSystem</tt><big>(</big><em>headers</em><big>)</big><a class="reference internal" href="_modules/pyamp/web/http/headers.html#Header.getOperatingSystem"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.web.http.headers.Header.getOperatingSystem" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the operating system from the given headers.</p>
<ul class="simple">
<li>headers &#8211; The headers</li>
</ul>
</dd></dl>

<dl class="method">
<dt id="pyamp.web.http.headers.Header.getValue">
<tt class="descname">getValue</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/pyamp/web/http/headers.html#Header.getValue"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.web.http.headers.Header.getValue" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the value for this header.</p>
</dd></dl>

<dl class="classmethod">
<dt id="pyamp.web.http.headers.Header.jsonContent">
<em class="property">classmethod </em><tt class="descname">jsonContent</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/pyamp/web/http/headers.html#Header.jsonContent"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.web.http.headers.Header.jsonContent" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a JSON content type header.</p>
</dd></dl>

<dl class="classmethod">
<dt id="pyamp.web.http.headers.Header.location">
<em class="property">classmethod </em><tt class="descname">location</tt><big>(</big><em>location</em><big>)</big><a class="reference internal" href="_modules/pyamp/web/http/headers.html#Header.location"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.web.http.headers.Header.location" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a location header.</p>
<ul class="simple">
<li>location &#8211; The location</li>
</ul>
</dd></dl>

<dl class="classmethod">
<dt id="pyamp.web.http.headers.Header.textHtmlContent">
<em class="property">classmethod </em><tt class="descname">textHtmlContent</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/pyamp/web/http/headers.html#Header.textHtmlContent"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.web.http.headers.Header.textHtmlContent" title="Permalink to this definition">¶</a></dt>
<dd><p>Create an text/html content type header.</p>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-pyamp.web.http.page">
<span id="the-page-module"></span><h2>The page module<a class="headerlink" href="#module-pyamp.web.http.page" title="Permalink to this headline">¶</a></h2>
<p>The page module contains the definition of the BasePage class
which provides the base functionality for implementing a page that
can be served by an HTTP server.</p>
<p>This module also contains other classes for defining various types
of pages.</p>
<dl class="class">
<dt id="pyamp.web.http.page.BasePage">
<em class="property">class </em><tt class="descclassname">pyamp.web.http.page.</tt><tt class="descname">BasePage</tt><a class="reference internal" href="_modules/pyamp/web/http/page.html#BasePage"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.web.http.page.BasePage" title="Permalink to this definition">¶</a></dt>
<dd><p>The BasePage class contains the basic functionality that is shared
among all pages.</p>
<p>Check that all the required properties are defined.</p>
<dl class="attribute">
<dt id="pyamp.web.http.page.BasePage.arguments">
<tt class="descname">arguments</tt><a class="headerlink" href="#pyamp.web.http.page.BasePage.arguments" title="Permalink to this definition">¶</a></dt>
<dd><p>The arguments class defines a dictionary mapping names of arguments
to actual Argument objects that this Page accepts. These can be required,
or optional arguments. This provides the ability to perform error
checking on the request to the page to determine if the correct number of
arguments was passed in the request.</p>
</dd></dl>

<dl class="attribute">
<dt id="pyamp.web.http.page.BasePage.contentType">
<tt class="descname">contentType</tt><a class="headerlink" href="#pyamp.web.http.page.BasePage.contentType" title="Permalink to this definition">¶</a></dt>
<dd><p>The contentType property contains the type of content contained
in this Page.</p>
</dd></dl>

<dl class="attribute">
<dt id="pyamp.web.http.page.BasePage.errorCodes">
<tt class="descname">errorCodes</tt><a class="headerlink" href="#pyamp.web.http.page.BasePage.errorCodes" title="Permalink to this definition">¶</a></dt>
<dd><p>The errorCodes property defines the list of error codes that will
respond with this Page in the event that any of the error codes are
encountered.</p>
</dd></dl>

<dl class="classmethod">
<dt id="pyamp.web.http.page.BasePage.get">
<em class="property">classmethod </em><tt class="descname">get</tt><big>(</big><em>requestHandler</em>, <em>path</em>, <em>arguments</em><big>)</big><a class="reference internal" href="_modules/pyamp/web/http/page.html#BasePage.get"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.web.http.page.BasePage.get" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the page.</p>
<ul class="simple">
<li>requestHandler &#8211; The request handler object</li>
<li>path &#8211; The requested path</li>
<li>arguments &#8211; The request arguments dictionary</li>
</ul>
</dd></dl>

<dl class="classmethod">
<dt id="pyamp.web.http.page.BasePage.getUrls">
<em class="property">classmethod </em><tt class="descname">getUrls</tt><big>(</big><big>)</big><a class="headerlink" href="#pyamp.web.http.page.BasePage.getUrls" title="Permalink to this definition">¶</a></dt>
<dd><p>Get a list of URLs which this Page supports. These URLs are used
in conjunction with the <a class="reference internal" href="#pyamp.web.http.page.BasePage.urls" title="pyamp.web.http.page.BasePage.urls"><tt class="xref py py-attr docutils literal"><span class="pre">urls</span></tt></a> class property.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This function should be overridden by concrete Pages to
provide a set of dynamically configured URLs.</p>
</div>
</dd></dl>

<dl class="attribute">
<dt id="pyamp.web.http.page.BasePage.urls">
<tt class="descname">urls</tt><a class="headerlink" href="#pyamp.web.http.page.BasePage.urls" title="Permalink to this definition">¶</a></dt>
<dd><p>The urls property defines the list of URLs that can be used to request
this Page.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">These URLs should all start with a forward slash.</p>
</div>
<p>Example:</p>
<div class="highlight-python"><pre>urls = ['/index.html', /test/directory/main.html']</pre>
</div>
</dd></dl>

<dl class="classmethod">
<dt id="pyamp.web.http.page.BasePage.validatePage">
<em class="property">classmethod </em><tt class="descname">validatePage</tt><big>(</big><big>)</big><a class="headerlink" href="#pyamp.web.http.page.BasePage.validatePage" title="Permalink to this definition">¶</a></dt>
<dd><p>Validate all of the properties for this page.</p>
<p>Return True to indicate success, False to indicate failure</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="pyamp.web.http.page.DirectoryFilesPage">
<em class="property">class </em><tt class="descclassname">pyamp.web.http.page.</tt><tt class="descname">DirectoryFilesPage</tt><a class="headerlink" href="#pyamp.web.http.page.DirectoryFilesPage" title="Permalink to this definition">¶</a></dt>
<dd><p>The DirectoryFilesPage class provides an implementation of a FilePage
which provides the ability to return any file contained within a specific
directory.</p>
<p>This class allows the path to the locally stored files to be defined, as
well as the HTML directory where the files are located. This class also
provides the ability to define a set of extensions used to filter the
files returned. Any file that has an extension that is contained within
the list of supported extensions will be requested using this Page.</p>
<p>Check that all the required properties are defined.</p>
<dl class="attribute">
<dt id="pyamp.web.http.page.DirectoryFilesPage.directoryPath">
<tt class="descname">directoryPath</tt><a class="headerlink" href="#pyamp.web.http.page.DirectoryFilesPage.directoryPath" title="Permalink to this definition">¶</a></dt>
<dd><p>The path to the locally stored files that this Page will return.</p>
</dd></dl>

<dl class="attribute">
<dt id="pyamp.web.http.page.DirectoryFilesPage.extensions">
<tt class="descname">extensions</tt><a class="headerlink" href="#pyamp.web.http.page.DirectoryFilesPage.extensions" title="Permalink to this definition">¶</a></dt>
<dd><p>The list of extensions used to filter files that are returned.</p>
</dd></dl>

<dl class="classmethod">
<dt id="pyamp.web.http.page.DirectoryFilesPage.getUrls">
<em class="property">classmethod </em><tt class="descname">getUrls</tt><big>(</big><big>)</big><a class="headerlink" href="#pyamp.web.http.page.DirectoryFilesPage.getUrls" title="Permalink to this definition">¶</a></dt>
<dd><p>Get a list of URLs which this Page supports. These URLs are used
in conjunction with the <tt class="xref py py-attr docutils literal"><span class="pre">urls</span></tt> class property.</p>
</dd></dl>

<dl class="attribute">
<dt id="pyamp.web.http.page.DirectoryFilesPage.htmlDirectory">
<tt class="descname">htmlDirectory</tt><a class="headerlink" href="#pyamp.web.http.page.DirectoryFilesPage.htmlDirectory" title="Permalink to this definition">¶</a></dt>
<dd><p>The HTML directory name where the files are stored. This is also the
path that will be prefixed to all requests for these pages.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="pyamp.web.http.page.FilePage">
<em class="property">class </em><tt class="descclassname">pyamp.web.http.page.</tt><tt class="descname">FilePage</tt><a class="headerlink" href="#pyamp.web.http.page.FilePage" title="Permalink to this definition">¶</a></dt>
<dd><p>The FilePage class implements a <a class="reference internal" href="#pyamp.web.http.page.BasePage" title="pyamp.web.http.page.BasePage"><tt class="xref py py-class docutils literal"><span class="pre">BasePage</span></tt></a> object which provides
the ability for pages to return the content of a file.</p>
<p>Check that all the required properties are defined.</p>
</dd></dl>

<dl class="class">
<dt id="pyamp.web.http.page.HtmlPage">
<em class="property">class </em><tt class="descclassname">pyamp.web.http.page.</tt><tt class="descname">HtmlPage</tt><a class="reference internal" href="_modules/pyamp/web/http/page.html#HtmlPage"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.web.http.page.HtmlPage" title="Permalink to this definition">¶</a></dt>
<dd><p>The HtmlPage class provides a base class that returns
a page containing text/html content.</p>
<p>Check that all the required properties are defined.</p>
<dl class="attribute">
<dt id="pyamp.web.http.page.HtmlPage.contentType">
<tt class="descname">contentType</tt><a class="headerlink" href="#pyamp.web.http.page.HtmlPage.contentType" title="Permalink to this definition">¶</a></dt>
<dd><p>Define the content type for the HtmlPage.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="pyamp.web.http.page.JsonPage">
<em class="property">class </em><tt class="descclassname">pyamp.web.http.page.</tt><tt class="descname">JsonPage</tt><a class="reference internal" href="_modules/pyamp/web/http/page.html#JsonPage"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.web.http.page.JsonPage" title="Permalink to this definition">¶</a></dt>
<dd><p>The HtmlPage class provides a base class that returns
a page containing JSON content.</p>
<p>Check that all the required properties are defined.</p>
<dl class="attribute">
<dt id="pyamp.web.http.page.JsonPage.contentType">
<tt class="descname">contentType</tt><a class="headerlink" href="#pyamp.web.http.page.JsonPage.contentType" title="Permalink to this definition">¶</a></dt>
<dd><p>Define the content type for the JsonPage.</p>
</dd></dl>

<dl class="classmethod">
<dt id="pyamp.web.http.page.JsonPage.get">
<em class="property">classmethod </em><tt class="descname">get</tt><big>(</big><em>requestHandler</em>, <em>path</em>, <em>arguments</em><big>)</big><a class="reference internal" href="_modules/pyamp/web/http/page.html#JsonPage.get"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.web.http.page.JsonPage.get" title="Permalink to this definition">¶</a></dt>
<dd><p>Override the get method to return JSON data.</p>
<ul class="simple">
<li>requestHandler &#8211; The request handler object</li>
<li>path &#8211; The requested path</li>
<li>arguments &#8211; The request arguments dictionary</li>
</ul>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-pyamp.web.http.requests">
<span id="the-requests-module"></span><h2>The requests module<a class="headerlink" href="#module-pyamp.web.http.requests" title="Permalink to this headline">¶</a></h2>
<p>The requests module contains classes pertaining to creating
various types of objects to handle HTTP requests.</p>
<dl class="class">
<dt id="pyamp.web.http.requests.BaseRequestHandler">
<em class="property">class </em><tt class="descclassname">pyamp.web.http.requests.</tt><tt class="descname">BaseRequestHandler</tt><big>(</big><em>request</em>, <em>client_address</em>, <em>server</em><big>)</big><a class="reference internal" href="_modules/pyamp/web/http/requests.html#BaseRequestHandler"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.web.http.requests.BaseRequestHandler" title="Permalink to this definition">¶</a></dt>
<dd><p>The BaseRequestHandler class provides the basic functionality that
is shared among all HTTP request handlers.</p>
<dl class="method">
<dt id="pyamp.web.http.requests.BaseRequestHandler.do_GET">
<tt class="descname">do_GET</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/pyamp/web/http/requests.html#BaseRequestHandler.do_GET"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.web.http.requests.BaseRequestHandler.do_GET" title="Permalink to this definition">¶</a></dt>
<dd><p>Process a GET request.</p>
</dd></dl>

<dl class="method">
<dt id="pyamp.web.http.requests.BaseRequestHandler.do_POST">
<tt class="descname">do_POST</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/pyamp/web/http/requests.html#BaseRequestHandler.do_POST"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.web.http.requests.BaseRequestHandler.do_POST" title="Permalink to this definition">¶</a></dt>
<dd><p>Process a POST request.</p>
</dd></dl>

<dl class="classmethod">
<dt id="pyamp.web.http.requests.BaseRequestHandler.initialize">
<em class="property">classmethod </em><tt class="descname">initialize</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#pyamp.web.http.requests.BaseRequestHandler.initialize" title="Permalink to this definition">¶</a></dt>
<dd><p>Initialize the request handler.</p>
<ul class="simple">
<li>args &#8211; Additional arguments</li>
<li>kwargs &#8211; Additional keyword arguments</li>
</ul>
</dd></dl>

<dl class="method">
<dt id="pyamp.web.http.requests.BaseRequestHandler.logError">
<tt class="descname">logError</tt><big>(</big><em>message</em><big>)</big><a class="headerlink" href="#pyamp.web.http.requests.BaseRequestHandler.logError" title="Permalink to this definition">¶</a></dt>
<dd><p>Log an error message.</p>
<ul class="simple">
<li>message &#8211; The message to log</li>
</ul>
</dd></dl>

<dl class="attribute">
<dt id="pyamp.web.http.requests.BaseRequestHandler.pageClasses">
<tt class="descname">pageClasses</tt><a class="headerlink" href="#pyamp.web.http.requests.BaseRequestHandler.pageClasses" title="Permalink to this definition">¶</a></dt>
<dd><p>The pageClasses property contains the list of <tt class="xref py py-class docutils literal"><span class="pre">Page</span></tt> classes
which this request handler is able to provide. The request handler will
be able to return requests based on the configured list of URLs for each
page, as well as any supported error codes each Page defines.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="pyamp.web.http.requests.StoppableRequestHandler">
<em class="property">class </em><tt class="descclassname">pyamp.web.http.requests.</tt><tt class="descname">StoppableRequestHandler</tt><big>(</big><em>request</em>, <em>client_address</em>, <em>server</em><big>)</big><a class="reference internal" href="_modules/pyamp/web/http/requests.html#StoppableRequestHandler"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.web.http.requests.StoppableRequestHandler" title="Permalink to this definition">¶</a></dt>
<dd><p>The StoppableRequestHandler class provides an implementation of
an HTTP request handler that handles the quit message send by a
server when it is trying to stop itself.</p>
<dl class="method">
<dt id="pyamp.web.http.requests.StoppableRequestHandler.do_QUIT">
<tt class="descname">do_QUIT</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/pyamp/web/http/requests.html#StoppableRequestHandler.do_QUIT"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.web.http.requests.StoppableRequestHandler.do_QUIT" title="Permalink to this definition">¶</a></dt>
<dd><p>Handle a QUIT message.</p>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-pyamp.web.http.server">
<span id="the-server-module"></span><h2>The server module<a class="headerlink" href="#module-pyamp.web.http.server" title="Permalink to this headline">¶</a></h2>
<p>The server module contains various classes pertaining to
creating HTTP servers.</p>
<dl class="class">
<dt id="pyamp.web.http.server.HttpServer">
<em class="property">class </em><tt class="descclassname">pyamp.web.http.server.</tt><tt class="descname">HttpServer</tt><big>(</big><em>port</em>, <em>requestHandlerClass</em>, <em>host=''</em><big>)</big><a class="reference internal" href="_modules/pyamp/web/http/server.html#HttpServer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.web.http.server.HttpServer" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a basic HTTP server.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">BaseHTTPServer</span> <span class="kn">import</span> <span class="n">BaseHTTPRequestHandler</span>


<span class="k">class</span> <span class="nc">RequestHandler</span><span class="p">(</span><span class="n">BaseHTTPRequestHandler</span><span class="p">):</span>
    <span class="k">def</span> <span class="nf">do_GET</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        
        <span class="k">print</span> <span class="s">&quot;GET:&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">path</span>

<span class="n">server</span> <span class="o">=</span> <span class="n">HttpServer</span><span class="p">(</span><span class="mi">12345</span><span class="p">,</span> <span class="n">RequestHandler</span><span class="p">)</span>
<span class="n">server</span><span class="o">.</span><span class="n">serve_forever</span><span class="p">()</span>
</pre></div>
</div>
<ul class="simple">
<li>port &#8211; The port for the server</li>
<li>requestHandlerClass &#8211; The class used to handle requests</li>
<li>host &#8211; The host name for the server</li>
</ul>
</dd></dl>

<dl class="class">
<dt id="pyamp.web.http.server.HttpServerThread">
<em class="property">class </em><tt class="descclassname">pyamp.web.http.server.</tt><tt class="descname">HttpServerThread</tt><big>(</big><em>port</em>, <em>requestHandlerClass</em>, <em>host=''</em><big>)</big><a class="reference internal" href="_modules/pyamp/web/http/server.html#HttpServerThread"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.web.http.server.HttpServerThread" title="Permalink to this definition">¶</a></dt>
<dd><p>The HttpServerThread class provides an implementation of an
HttpServer that runs in its own thread.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">time</span> <span class="kn">import</span> <span class="n">sleep</span>

<span class="kn">from</span> <span class="nn">pyamp.web.http.requests</span> <span class="kn">import</span> <span class="n">StoppableRequestHandler</span>


<span class="n">server</span> <span class="o">=</span> <span class="n">HttpServerThread</span><span class="p">(</span><span class="mi">12345</span><span class="p">,</span> <span class="n">StoppableRequestHandler</span><span class="p">)</span>
<span class="n">server</span><span class="o">.</span><span class="n">start</span><span class="p">()</span>

<span class="k">while</span> <span class="bp">True</span><span class="p">:</span>
    <span class="k">try</span><span class="p">:</span>
        <span class="n">sleep</span><span class="p">(</span><span class="mf">0.1</span><span class="p">)</span>
    <span class="k">except</span> <span class="p">(</span><span class="ne">KeyboardInterrupt</span><span class="p">,</span> <span class="ne">SystemExit</span><span class="p">):</span>
        <span class="k">print</span> <span class="s">&quot;Stopping server!&quot;</span>
        <span class="n">server</span><span class="o">.</span><span class="n">shutdown</span><span class="p">()</span>
        <span class="k">break</span>

<span class="k">print</span> <span class="s">&quot;Done.&quot;</span>
</pre></div>
</div>
<ul class="simple">
<li>port &#8211; The port for the server</li>
<li>requestHandlerClass &#8211; The class used to handle requests</li>
<li>host &#8211; The host name for the server</li>
</ul>
<dl class="method">
<dt id="pyamp.web.http.server.HttpServerThread.onCycle">
<tt class="descname">onCycle</tt><big>(</big><em>_i</em><big>)</big><a class="headerlink" href="#pyamp.web.http.server.HttpServerThread.onCycle" title="Permalink to this definition">¶</a></dt>
<dd><p>Called once during every cycle of the thread.</p>
<ul class="simple">
<li>_i &#8211; The current cycle number</li>
</ul>
</dd></dl>

<dl class="method">
<dt id="pyamp.web.http.server.HttpServerThread.onShutdown">
<tt class="descname">onShutdown</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/pyamp/web/http/server.html#HttpServerThread.onShutdown"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.web.http.server.HttpServerThread.onShutdown" title="Permalink to this definition">¶</a></dt>
<dd><p>Called in the event that the Thread is shut down.</p>
</dd></dl>

<dl class="method">
<dt id="pyamp.web.http.server.HttpServerThread.onStop">
<tt class="descname">onStop</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/pyamp/web/http/server.html#HttpServerThread.onStop"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.web.http.server.HttpServerThread.onStop" title="Permalink to this definition">¶</a></dt>
<dd><p>Called in the event that the Thread is stopped.</p>
</dd></dl>

</dd></dl>

</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h3><a href="index.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">The web module</a><ul>
<li><a class="reference internal" href="#module-pyamp.web.hacking">The hacking module</a></li>
<li><a class="reference internal" href="#id1">The web module</a></li>
<li><a class="reference internal" href="#module-pyamp.web.http">The http module</a></li>
<li><a class="reference internal" href="#module-pyamp.web.http.constants">The constants module</a></li>
<li><a class="reference internal" href="#module-pyamp.web.http.headers">The headers module</a></li>
<li><a class="reference internal" href="#module-pyamp.web.http.page">The page module</a></li>
<li><a class="reference internal" href="#module-pyamp.web.http.requests">The requests module</a></li>
<li><a class="reference internal" href="#module-pyamp.web.http.server">The server module</a></li>
</ul>
</li>
</ul>

  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="_sources/web.txt"
           rel="nofollow">Show Source</a></li>
  </ul>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" size="18" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li><a href="index.html">pyamp v1.2 documentation</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2012, Brett Ponsler.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.1.
    </div>
  </body>
</html>